import java.util.*;

public class Solution894 {

    public static class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode() {
        }

        TreeNode(int val) {
            this.val = val;
        }

        TreeNode(int val, TreeNode left, TreeNode right) {
            this.val = val;
            this.left = left;
            this.right = right;
        }
    }

    Map<Integer,List<TreeNode>> map=new HashMap<>();

    public List<TreeNode> allPossibleFBT(int n) {
        if (!map.containsKey(n)){
            List<TreeNode> ans=new ArrayList<>();
            if (n%2==0){
                map.put(n,ans);
            }else{
                if (n==1){
                    map.put(1, Collections.singletonList(new TreeNode(0)));
                }else{
                    for (int i=1;i<n;i+=2){
                        List<TreeNode> l1=allPossibleFBT(i);
                        if (i==n-1-i){
                            for (int k=0;k<l1.size();k++){
                                ans.add(new TreeNode(0,l1.get(k),l1.get(k)));
                                for (int l=k+1;l<l1.size();l++){
                                    ans.add(new TreeNode(0,l1.get(k),l1.get(l)));
                                    ans.add(new TreeNode(0,l1.get(l),l1.get(k)));
                                }
                            }
                        }else{
                            List<TreeNode> l2=allPossibleFBT(n-1-i);
                            for (TreeNode treeNode : l1) {
                                for (TreeNode node : l2) {
                                    ans.add(new TreeNode(0,treeNode,node));
                                }
                            }
                        }
                    }
                    map.put(n,ans);
                }
            }
        }
        return map.get(n);
    }

    public static void main(String[] args) {
        System.out.println(new Solution894().allPossibleFBT(7).size());
    }
}
